/**
 * Created by Administrator on 2017/4/18.
 */
angular.module('service.home', [
    "ngResource",
])
    //获取商店列表
    .service('HomeService', ['$resource', function ($resource) {
        this.getid = function(code){
            var reg = new RegExp("(^|&)" + code + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            var id = '';
            var data;
            if (r) {
                id = unescape(r[2]);
            }
            return id;
        }
        this.updateByid = function(code,success,error){
            var id = this.getid('verificationid');
            var shopid = this.getid('shopid');
            if(id){
                var resource = $resource(verificationurl+'verification/byverificationid/:verificationid/:code')
                return resource.save({verificationid:id,code:code},{},success,error)
            }
            else{
                var resource = $resource(verificationurl+'verification/byshopid/:shopid/:code')
                return resource.save({shopid:shopid,code:code},{},success,error)
            }
        };
    }])



